package csci3033.RecordaNote;

import java.io.Serializable;
import java.util.Calendar;
import java.util.List;

@SuppressWarnings("serial")
public class Recording implements Serializable {

		//private String 		filename;
		private String 			name;
		private Calendar		date;
		private String			timestamp;
		private String			notes;
		private boolean			todo;
		private List<Marker> 	markers;
		
		public Recording() {
			
		}
		
		public Recording(String name) {
			this.name = name;
			this.todo = false;
		}
		
		public Recording(String notes, boolean toDo, Calendar date) {
			this.notes = notes;
			this.todo = toDo;
			this.date = date;
			
			setTimestamp();
			this.name = timestamp;
		}
		
		@Override
		public String toString() {
			return name;
		}
		
		public void setTimestamp() {
			String amOrPm;
			int	   hour   = date.get(Calendar.HOUR);
			int    minute = date.get(Calendar.MINUTE);
			int    second = date.get(Calendar.SECOND);
			String minuteStr = ("" + minute);
			String secondStr = ("" + second);
			
			if (date.get(Calendar.AM_PM) == 0) {
				amOrPm = "AM";
			}
			else {
				amOrPm = "PM";
			}
			
			if (hour == 0 ) {
				hour = 12;
			}
			
			if (minute < 10) {
				minuteStr = ("0" + minute);
			}
			if (second < 10) {
				secondStr = ("0" + second);
			}
			
			this.timestamp = ("" + hour + ":"
								+ minuteStr + ":"
								+ secondStr + " "
								+ amOrPm + "  "
								+ (date.get(Calendar.MONTH) + 1) + "/"
								+ date.get(Calendar.DAY_OF_MONTH) + "/"
								+ date.get(Calendar.YEAR));
		}
		
		public void setName(String name) {
			this.name = name;
		}
		
		public String getTimestamp() {
			return timestamp;
		}
		
		public String getName() {
			return name;
		}
		
		public String getNotes() {
			return notes;
		}
		
		public List<Marker> getMarkers() {
			return markers;
		}
		
		public boolean toDo() {
			return todo;
		}
		
		public void newMarker() {
			//markers.add(new Marker());
		}
		
		public void setToDo(boolean toDo) {
			this.todo = toDo;
		}
		/*
		private void startRecording() {
			
		}
		*/
}
